package com.hmy.finance.service.core;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hmy.finance.dal.po.DeviceDailyBillPo;
import com.hmy.finance.dal.po.DeviceRentalRecordPo;

import java.time.LocalDate;
import java.util.List;

/**
 * @author songkf
 * @description 针对表【device_daily_bill(设备日费用账单流水)】的数据库操作Service
 * @createDate 2024-02-21 18:55:01
 */
public interface IDeviceDailyBillService extends IService<DeviceDailyBillPo> {
    /**
     * 批量保存设备日费用流水
     *
     * @param deviceDailyBillPoList 设备日费用流水列表
     * @return int 保存成功的数量
     * @author songkf
     */
    int saveBatchDeviceDailyBill(List<DeviceDailyBillPo> deviceDailyBillPoList);

    /**
     * 根据设备租赁记录ID和处理日期查询设备日费用流水
     *
     * @param deviceRentalRecordId 设备租赁记录ID
     * @param handleDate           处理日期
     * @return <DeviceDailyBillPo> 设备日费用流水
     * @author songkf
     */
    DeviceDailyBillPo queryDeviceDailyBillByDeviceRentalRecordIdWithDate(Long deviceRentalRecordId, LocalDate handleDate);

    Boolean clearDeviceDailyBill(List<DeviceRentalRecordPo> rentingDeviceList, LocalDate localDate);

    /**
     * 根据租赁记录ID集合和日期区间查询设备日费用流水
     *
     * @param deviceRentalRecordIdList 设备租赁记录ID集合
     * @param localDate                处理日期
     * @param now                      当前日期
     * @return List<DeviceDailyBillPo> 设备日费用流水列表
     */
    List<DeviceDailyBillPo> queryDeviceDailyBillListByRentalRecordIdAndDateArea(List<Long> deviceRentalRecordIdList, LocalDate localDate, LocalDate now);

    List<DeviceDailyBillPo> queryDeviceDailyBillListByContractIdAndDateArea(List<Long> deviceRentalRecordIdList, LocalDate localDate, LocalDate now);

    public List<DeviceDailyBillPo> queryDeviceDailyBillListByContractIdAndDateArea(Long contractId, LocalDate handleDate, LocalDate handleDate1);

    /**
     * Select device daily bill by contract id and offset through date
     *
     * @param contractId the ID of the sale contract
     * @param startDate  the offset start date
     * @param endDate    the offset end date
     * @return the list of device daily bill
     * @author songkf
     */
    List<DeviceDailyBillPo> selectByContractIdAndOffsetThroughDate(Long contractId, LocalDate startDate, LocalDate endDate);

    List<DeviceDailyBillPo> queryDeviceDailyBillByDeviceRentalRecordIdWithDateArea(Long deviceRentalRecordId, LocalDate overdueStartDate, LocalDate overdueEndDate);
}
